home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 98 / Skunkware 98.iso / src / net / bind-contrib.tar.gz / bind-contrib.tar / contrib / multizdb / MZDB.patch < prev    next >
Encoding:
Text File  |  1996-10-25  |  8.8 KB  |  367 lines

  1. *** b493b9/conf/options.h    Fri Jul 22 04:42:30 1994
  2. --- b493b9m/conf/options.h    Sun Jul 24 17:53:36 1994
  3. ***************
  4. *** 111,116 ****
  5. --- 111,117 ----
  6.   #define CLEANCACHE    /* useful and necessary in the face of NCACHE */
  7.   #define STATS        /* keep nameserver statistics; uses more memory */
  8.   /*#define RENICE      /* named-xfer should run at normal priority */
  9. + #define MULTIZDB    /* allow Multizone Database files */
  10.   
  11.   /*--------------------------------------------*
  12.    * no user-servicable parts beyond this point *
  13. *** b493b9/named/db_func.h    Sat Jul 23 02:32:12 1994
  14. --- b493b9m/named/db_func.h    Sat Jul 23 18:01:28 1994
  15. ***************
  16. *** 48,54 ****
  17. --- 48,58 ----
  18.               free_netlist __P((struct netinfo **));
  19.   extern int        getword __P((char *, int, FILE *)),
  20.               getnum __P((FILE *, char *, int)),
  21. + #ifdef MULTIZDB
  22. +             db_load __P((char *, char *, struct zoneinfo *, int, FILE *)),
  23. + #else
  24.               db_load __P((char *, char *, struct zoneinfo *, int)),
  25. + #endif
  26.               position_on_netlist __P((struct in_addr,
  27.                            struct netinfo *));
  28.   extern struct netinfo    *addr_on_netlist __P((struct in_addr,
  29. *** b493b9/named/ns_defs.h    Sat Jul 23 02:32:12 1994
  30. --- b493b9m/named/ns_defs.h    Sun Jul 24 17:22:05 1994
  31. ***************
  32. *** 117,122 ****
  33. --- 117,125 ----
  34.       u_int32_t    z_minimum;    /* minimum TTL value */
  35.       u_int32_t    z_serial;    /* changes if zone modified */
  36.       char        *z_source;    /* source location of data */
  37. + #ifdef MULTIZDB
  38. +     char        *z_msource;    /* multizone source file */
  39. + #endif /* MULITZDB */
  40.       time_t        z_ftime;    /* modification time of source file */
  41.       struct in_addr    z_xaddr;    /* override server for next xfer */
  42.       struct in_addr    z_addr[NSMAX];    /* list of master servers for zone */
  43. *** b493b9/named/ns_func.h    Fri Jul 22 04:42:46 1994
  44. --- b493b9m/named/ns_func.h    Sat Jul 23 18:05:13 1994
  45. ***************
  46. *** 108,113 ****
  47. --- 108,118 ----
  48.   
  49.   /* ++from ns_init.c++ */
  50.   extern void        ns_init __P((char *));
  51. + #ifdef MULTIZDB
  52. + extern void        process_zone_line __P((int, char *, FILE *, FILE *));
  53. + #else
  54. + extern void        process_zone_line __P((int, char *, FILE *));
  55. + #endif
  56.   /* --from ns_init.c-- */
  57.   
  58.   /* ++from ns_ncache.c++ */
  59. *** b493b9/named/ns_maint.c    Sat Jun 11 18:04:56 1994
  60. --- b493b9m/named/ns_maint.c    Tue Jul 19 20:13:39 1994
  61. ***************
  62. *** 756,762 ****
  63. --- 756,766 ----
  64.   #else
  65.               remove_zone(hashtab, zp - zones);
  66.   #endif
  67. + #ifdef MULTIZDB
  68. +             if (db_load(zp->z_source, zp->z_origin, zp, 0, 0) == 0)
  69. + #else
  70.               if (db_load(zp->z_source, zp->z_origin, zp, 0) == 0)
  71. + #endif
  72.                   zp->z_flags |= Z_AUTH;
  73.               if (zp->z_flags & Z_TMP_FILE)
  74.                   (void) unlink(zp->z_source);
  75. *** b493b9/named/db_load.c    Sat Jul 23 03:20:35 1994
  76. --- b493b9m/named/db_load.c    Sun Jul 24 17:46:35 1994
  77. ***************
  78. *** 142,147 ****
  79. --- 142,155 ----
  80.   #define INCLUDE    5
  81.   #define ORIGIN    6
  82.   #define ERROR    7
  83. + #ifdef MULTIZDB
  84. + #define PRIMARY 8
  85. + #define SECONDARY 9
  86. + #define CACHE 10
  87. + #ifdef STUBS
  88. + #define STUB 11
  89. + #endif /* STUBS */
  90. + #endif /* MULTIZDB */
  91.   
  92.   static int clev;    /* a zone deeper in a heirachy has more credability */
  93.   
  94. ***************
  95. *** 156,162 ****
  96. --- 164,175 ----
  97.    *    >0 = number of errors encountered
  98.    */
  99.   int
  100. + #ifdef MULTIZDB
  101. + db_load(filename, in_origin, zp, doinginclude, mzfp)
  102. +     FILE *mzfp;  /* multizone database file already open */
  103. + #else
  104.   db_load(filename, in_origin, zp, doinginclude)
  105. + #endif /* MULTIZDB */
  106.       char *filename, *in_origin;
  107.       struct zoneinfo *zp;
  108.       int doinginclude;
  109. ***************
  110. *** 179,193 ****
  111.       struct stat sb;
  112.       struct in_addr ina;
  113.   
  114.       if (!doinginclude) {
  115.           read_soa = 0;
  116.           clev = db_getclev(in_origin);
  117.       }
  118.   
  119. !     dprintf(1, (ddt,"db_load(%s, %s, %d, %d)\n",
  120. !             filename, in_origin, zp - zones, doinginclude));
  121. !     (void) strcpy(origin, in_origin);
  122.       if ((fp = fopen(filename, "r")) == NULL) {
  123.           syslog(LOG_ERR, "%s: %m", filename);
  124.           dprintf(1, (ddt, "db_load: error opening file %s\n",
  125. --- 192,215 ----
  126.       struct stat sb;
  127.       struct in_addr ina;
  128.   
  129. + #ifdef MULTIZDB
  130. +     if (!doinginclude  &&  zp) {
  131. + #else
  132.       if (!doinginclude) {
  133. + #endif /* MULTIZDB */
  134.           read_soa = 0;
  135.           clev = db_getclev(in_origin);
  136.       }
  137.   
  138. ! #ifdef MULTIZDB
  139. !     if (mzfp)
  140. !     {
  141. !         fp = mzfp;
  142. !         filename = "--multizone file--";
  143. !     }
  144. !     else
  145. !     {
  146. ! #endif /* MULTIZDB */
  147.       if ((fp = fopen(filename, "r")) == NULL) {
  148.           syslog(LOG_ERR, "%s: %m", filename);
  149.           dprintf(1, (ddt, "db_load: error opening file %s\n",
  150. ***************
  151. *** 194,199 ****
  152. --- 216,229 ----
  153.                   filename));
  154.           return (-1);
  155.       }
  156. + #ifdef MULTIZDB
  157. +     }
  158. +     (void) strcpy(origin, in_origin);
  159. +     dprintf(1, (ddt,"db_load(%s, %s, %d, %d)\n",
  160. +             filename, in_origin?in_origin:"--", zp?(zp - zones):-1, doinginclude));
  161. +     if (zp)
  162. +     {
  163. + #endif /* MULTIZDB */
  164.       if (zp->z_type == Z_CACHE) {
  165.           dbflags = DB_NODATA | DB_NOHINTS;
  166.           dataflags = DB_F_HINT;
  167. ***************
  168. *** 211,219 ****
  169. --- 241,261 ----
  170.       domain[0] = '\0';
  171.       class = zp->z_class;
  172.       zp->z_flags &= ~(Z_INCLUDE|Z_DB_BAD);
  173. + #ifdef MULTIZDB
  174. +     }
  175. + #endif /* MULTIZDB */
  176.        while ((c = gettoken(fp, filename)) != EOF) {
  177.           switch (c) {
  178.           case INCLUDE:
  179. + #ifdef MULTIZDB
  180. +             if (!zp)
  181. +             {
  182. +                 syslog(LOG_ERR, "%s: ignoring $INCLUDE inside multizone file\n", filename);
  183. +                 endline(fp);
  184. +                 ++errs;
  185. +                 continue;
  186. +             }
  187. + #endif /* MULTIZDB */
  188.               if (!getword((char *)buf, sizeof(buf), fp))
  189.                   /* file name*/
  190.                   break;
  191. ***************
  192. *** 224,230 ****
  193. --- 266,276 ----
  194.                   endline(fp);
  195.               }
  196.               didinclude = 1;
  197. + #ifdef MULTIZDB
  198. +             errs += db_load((char *)buf, tmporigin, zp, 1, 0);
  199. + #else
  200.               errs += db_load((char *)buf, tmporigin, zp, 1);
  201. + #endif
  202.               continue;
  203.   
  204.           case ORIGIN:
  205. ***************
  206. *** 237,242 ****
  207. --- 283,344 ----
  208.               dprintf(3, (ddt, "db_load: origin now %s\n", origin));
  209.               continue;
  210.   
  211. + #ifdef MULTIZDB
  212. +         case PRIMARY:
  213. +             if (mzfp)
  214. +             {
  215. +                 process_zone_line(Z_PRIMARY, buf, fp, mzfp);
  216. +             }
  217. +             else
  218. +             {
  219. +                 syslog(LOG_ERR, "%s: $PRIMARY only valid inside multizone file\n", filename);
  220. +                 endline(fp);
  221. +                 ++errs;
  222. +             }
  223. +             continue;
  224. +             
  225. +         case SECONDARY:
  226. +             if (mzfp)
  227. +             {
  228. +                 process_zone_line(Z_SECONDARY, buf, fp, mzfp);
  229. +             }
  230. +             else
  231. +             {
  232. +                 syslog(LOG_ERR, "%s: $SECONDARY only valid inside multizone file\n", filename);
  233. +                 endline(fp);
  234. +                 ++errs;
  235. +             }
  236. +             continue;
  237. +             
  238. +         case CACHE:
  239. +             if (mzfp)
  240. +             {
  241. +                 process_zone_line(Z_CACHE, buf, fp, mzfp);
  242. +             }
  243. +             else
  244. +             {
  245. +                 syslog(LOG_ERR, "%s: $CACHE only valid inside multizone file\n", filename);
  246. +                 endline(fp);
  247. +                 ++errs;
  248. +             }
  249. +             continue;
  250. +             
  251. + #ifdef STUBS
  252. +         case STUB:
  253. +             if (mzfp)
  254. +             {
  255. +                 process_zone_line(Z_STUB, buf, fp, mzfp);
  256. +             }
  257. +             else
  258. +             {
  259. +                 syslog(LOG_ERR, "%s: $STUB only valid inside multizone file\n", filename);
  260. +                 endline(fp);
  261. +                 ++errs;
  262. +             }
  263. +             continue;
  264. +             
  265. + #endif /* STUBS */
  266. + #endif /* MULTIZDB */
  267.           case DNAME:
  268.               if (!getword(domain, sizeof(domain), fp))
  269.                   break;
  270. ***************
  271. *** 608,613 ****
  272. --- 710,718 ----
  273.               if (type == T_SOA && zp->z_type == Z_STUB)
  274.                   continue;
  275.   #endif
  276. + #ifdef ATTELS
  277. + #undef NO_GLUE
  278. + #endif
  279.   #ifdef NO_GLUE
  280.               /*
  281.                * Ignore data outside the zone.
  282. ***************
  283. *** 658,664 ****
  284.           if (c == '\n')
  285.               lineno++;
  286.       }
  287. !     (void) my_fclose(fp);
  288.       lineno = slineno;
  289.       if (doinginclude == 0) {
  290.           if (didinclude) {
  291. --- 763,780 ----
  292.           if (c == '\n')
  293.               lineno++;
  294.       }
  295. ! #ifdef MULTIZDB
  296. !     if (!mzfp)
  297. !     {
  298. ! #endif /* MULTIZDB */
  299. !         (void) my_fclose(fp);
  300. ! #ifdef MULTIZDB
  301. !     }
  302. ! #endif /* MULTIZDB */
  303. ! #ifdef MULTIZDB
  304. !     if (zp)
  305. !     {
  306. ! #endif /* MULTIZDB */
  307.       lineno = slineno;
  308.       if (doinginclude == 0) {
  309.           if (didinclude) {
  310. ***************
  311. *** 670,679 ****
  312.           if (zp->z_type != Z_CACHE && read_soa != 1) {
  313.               errs++;
  314.               if (read_soa == 0)
  315. !                 syslog(LOG_ERR, "%s: no SOA record", filename);
  316.               else
  317. !                 syslog(LOG_ERR, "%s: multiple SOA records",
  318. !                     filename);
  319.           }
  320.       }
  321.   #ifdef SECURE_ZONES
  322. --- 786,795 ----
  323.           if (zp->z_type != Z_CACHE && read_soa != 1) {
  324.               errs++;
  325.               if (read_soa == 0)
  326. !                 syslog(LOG_ERR, "%s: no SOA record for %s\n", filename, zp->z_origin);
  327.               else
  328. !                 syslog(LOG_ERR, "%s: multiple SOA records for %s\n",
  329. !                        filename, zp->z_origin);
  330.           }
  331.       }
  332.   #ifdef SECURE_ZONES
  333. ***************
  334. *** 681,686 ****
  335. --- 797,805 ----
  336.   #endif
  337.       if (errs)
  338.           zp->z_flags |= Z_DB_BAD;
  339. + #ifdef MULTIZDB
  340. +     }
  341. + #endif /* MULTIZDB */
  342.       return (errs);
  343.   }
  344.   
  345. ***************
  346. *** 705,710 ****
  347. --- 824,841 ----
  348.                       return (INCLUDE);
  349.                   if (!strcasecmp("origin", op))
  350.                       return (ORIGIN);
  351. + #ifdef MULTIZDB
  352. +                 if (!strncasecmp("primary", op, 7))
  353. +                     return (PRIMARY);
  354. +                 if (!strncasecmp("secondary", op, 9))
  355. +                     return (SECONDARY);
  356. +                 if (!strncasecmp("cache", op, 5))
  357. +                     return (CACHE);
  358. + #ifdef STUBS
  359. +                 if (!strncasecmp("stub", op, 4))
  360. +                     return (STUB);
  361. + #endif /* STUBS */
  362. + #endif /* MULTIZDB */
  363.               }
  364.               dprintf(1, (ddt,
  365.                       "%s: line %d: Unknown $ option: $%s\n", 
  366.